home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus Extra 1996 #3 / AmigaPlus_CD-ROM-EXTRA_Nr.3.bin / aminet-spiele / role on / larn / regen.c < prev    next >
C/C++ Source or Header  |  1997-12-31  |  4KB  |  95 lines

  1. /* regen.c */
  2. #include "header.h"
  3. #include "larndefs.h"
  4. #include "monsters.h"
  5. #include "player.h"
  6.  
  7. /*
  8.     regen()
  9.  
  10.     subroutine to regenerate player hp and spells
  11.  */
  12. regen()
  13.     {
  14.     register int i,flag;
  15.     register long *d;
  16.     d = c;
  17. #ifdef EXTRA
  18.     d[MOVESMADE]++;
  19. #endif
  20.     if (d[TIMESTOP])  { if(--d[TIMESTOP]<=0) bottomline();  return; }   /* for stop time spell */
  21.     flag=0;
  22.  
  23.     if (d[STRENGTH]<3)  { d[STRENGTH]=3; flag=1; }
  24.     if (d[HP] != d[HPMAX])
  25.         if (d[REGENCOUNTER]-- <= 0)     /*  regenerate hit points   */
  26.             {
  27.             d[REGENCOUNTER] = 22 + (d[HARDGAME]<<1) - d[LEVEL];
  28.             if ((d[HP] += d[REGEN]) > d[HPMAX])  d[HP] = d[HPMAX];
  29.             bottomhp();
  30.             }
  31.  
  32.     if (d[SPELLS] < d[SPELLMAX])        /*  regenerate spells   */
  33.         if (d[ECOUNTER]-- <= 0)
  34.             {
  35.             d[ECOUNTER] = 100+4*(d[HARDGAME]-d[LEVEL]-d[ENERGY]);
  36.             d[SPELLS]++;    bottomspell();
  37.             }
  38.  
  39.     if (d[HERO])            if (--d[HERO]<=0) { for (i=0; i<6; i++) d[i] -= 10; flag=1; }
  40.     if (d[ALTPRO])          if (--d[ALTPRO]<=0)         { d[MOREDEFENSES]-=3; flag=1; }
  41.     if (d[PROTECTIONTIME])  if (--d[PROTECTIONTIME]<=0) { d[MOREDEFENSES]-=2; flag=1; }
  42.     if (d[DEXCOUNT])        if (--d[DEXCOUNT]<=0)       { d[DEXTERITY]-=3; flag=1; }
  43.     if (d[STRCOUNT])        if (--d[STRCOUNT]<=0)       { d[STREXTRA]-=3; flag=1; }
  44.     if (d[BLINDCOUNT])      if (--d[BLINDCOUNT]<=0)     { cursors();  lprcat("\nThe blindness lifts  "); beep(); }
  45.     if (d[CONFUSE])         if (--d[CONFUSE]<=0) { cursors();  lprcat("\nYou regain your senses"); beep(); }
  46.     if (d[GIANTSTR])        if (--d[GIANTSTR]<=0) { d[STREXTRA] -= 20; flag=1; }
  47.     if (d[CHARMCOUNT])      if ((--d[CHARMCOUNT]) <= 0) flag=1;
  48.     if (d[INVISIBILITY])    if ((--d[INVISIBILITY]) <= 0) flag=1;
  49.     if (d[CANCELLATION])    if ((--d[CANCELLATION]) <= 0) flag=1;
  50.     if (d[WTW])             if ((--d[WTW]) <= 0) flag=1;
  51.     if (d[HASTESELF])       if ((--d[HASTESELF]) <= 0) flag=1;
  52.     if (d[AGGRAVATE])       --d[AGGRAVATE]; 
  53.     if (d[SCAREMONST])      if ((--d[SCAREMONST]) <= 0) flag=1; 
  54.     if (d[STEALTH])         if ((--d[STEALTH]) <= 0) flag=1; 
  55.     if (d[AWARENESS])       --d[AWARENESS];
  56.     if (d[HOLDMONST])       if ((--d[HOLDMONST]) <= 0) flag=1;
  57.     if (d[HASTEMONST])      --d[HASTEMONST];
  58.     if (d[FIRERESISTANCE])  if ((--d[FIRERESISTANCE]) <= 0) flag=1;
  59.     if (d[GLOBE])           if (--d[GLOBE]<=0) { d[MOREDEFENSES]-=10; flag=1; }
  60.     if (d[SPIRITPRO])       if (--d[SPIRITPRO] <= 0) flag=1;
  61.     if (d[UNDEADPRO])       if (--d[UNDEADPRO] <= 0) flag=1;
  62.     if (d[HALFDAM])         if (--d[HALFDAM]<=0)  { cursors();  lprcat("\nYou now feel better "); beep(); }
  63.     if (d[SEEINVISIBLE])
  64.       if (--d[SEEINVISIBLE]<=0)
  65.         { monstnamelist[INVISIBLESTALKER] = floorc;
  66.           if (!d[BLINDCOUNT]) {
  67.             cursors();
  68.             lprcat("\nYou feel your vision return to normal");
  69.             beep();
  70.           }
  71.         }
  72.     if (d[ITCHING])
  73.         {
  74.         if (d[ITCHING]>1)
  75.             if ((d[WEAR]!= -1) || (d[SHIELD]!= -1))
  76.                 if (rnd(100)<50)
  77.                     {
  78.                     d[WEAR]=d[SHIELD]= -1; cursors();
  79.                     lprcat("\nThe hysteria of itching forces you to remove your armor!"); 
  80.                     beep(); recalc();  bottomline();
  81.                     }
  82.         if (--d[ITCHING]<=0) { cursors();  lprcat("\nYou now feel the irritation subside!"); beep(); }
  83.         }
  84.     if (d[CLUMSINESS])
  85.         {
  86.         if (d[WIELD] != -1)
  87.             if (d[CLUMSINESS]>1)
  88.               if (item[playerx][playery]==0)    /* only if nothing there */
  89.                 if (rnd(100)<33) /* drop your weapon due to clumsiness */
  90.                     drop_object((int)d[WIELD]);
  91.         if (--d[CLUMSINESS]<=0) { cursors();  lprcat("\nYou now feel less awkward!"); beep(); }
  92.         }
  93.     if (flag) bottomline();
  94.     }
  95.